#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3f;

void solve()
{
    int n;
    cin >> n;
    vector<int> even, odd;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if (x & 1) odd.push_back(x);
        else even.push_back(x);
    }
    sort(even.begin(), even.end());
    sort(odd.begin(), odd.end());
    for (int i = 0; i < even.size(); i++) cout << even[i] << ' ';
    for (int i = 0; i < odd.size(); i++) cout << odd[i] << ' ';
    cout << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}